class GreenSimulationsController < ApplicationController
  # GET /green_simulations
  # GET /green_simulations.json
  def index
    @green_simulations = GreenSimulation.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @green_simulations }
    end
  end

  # GET /green_simulations/1
  # GET /green_simulations/1.json
  def show
    @green_simulation = GreenSimulation.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @green_simulation }
    end
  end

  # GET /green_simulations/new
  # GET /green_simulations/new.json
  def new
    @green_simulation = GreenSimulation.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @green_simulation }
    end
  end

  # GET /green_simulations/1/edit
  def edit
    @green_simulation = GreenSimulation.find(params[:id])
  end

  # POST /green_simulations
  # POST /green_simulations.json
  def create
    @green_simulation = GreenSimulation.new(params[:green_simulation])

    respond_to do |format|
      if @green_simulation.save
        format.html { redirect_to @green_simulation, notice: 'Green simulation was successfully created.' }
        format.json { render json: @green_simulation, status: :created, location: @green_simulation }
      else
        format.html { render action: "new" }
        format.json { render json: @green_simulation.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /green_simulations/1
  # PUT /green_simulations/1.json
  def update
    @green_simulation = GreenSimulation.find(params[:id])

    respond_to do |format|
      if @green_simulation.update_attributes(params[:green_simulation])
        format.html { redirect_to @green_simulation, notice: 'Green simulation was successfully updated.' }
        format.json { head :ok }
      else
        format.html { render action: "edit" }
        format.json { render json: @green_simulation.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /green_simulations/1
  # DELETE /green_simulations/1.json
  def destroy
    @green_simulation = GreenSimulation.find(params[:id])
    @green_simulation.destroy

    respond_to do |format|
      format.html { redirect_to green_simulations_url }
      format.json { head :ok }
    end
  end
end
